/**
    @file ctc_at_ftm.h

    @author  Copyright (C) 2011 Centec Networks Inc.  All rights reserved.

    @date 2012-10-19

    @version v2.0

\p
  FTM technology supports flexible table sizes targeting different application scenario.
  All FTM tables are dynamic which reside in one or more physical memory block(s).
  The size of the table is decided based on a given profile and  memory is allocated at system initialization
\p
  FTM technology supports flexible table items management targeting different application scenario. 
  Dynamic tables are allocated on demand to meet different requirements and maximize memory utilization.
  The flexible table items can be logically divided into three parts: DynamicDs, LpmTcam and FlowTcam, in which DynamicDs includes Key, AD and Edit.
  If the service has no requirements for line speed performance, some DynamicDs resources can support couple mode. 
\d    For example: FDB table resources
\d    Under the condition that MacDa and MacSa need parallel lookup to ensure line speed, table resources can not apply couple mode. 
\d    Under the condition that MacDa and MacSa do not need parallel lookup, table resources can apply couple mode to expand specifications.
\p
  FTM technology supports scenarios in which different applications share resources. 
  Save memory of SDK internal software table by limiting specifications of some applications.
  Relevant API references: ctcs_ftm_set_profile_specs/ctcs_ftm_get_profile_specs.
\p
  FTM technology supports different specifications for different chips. Please contact centec for specific parameters.
\p
  For class Key resources in DynamicDs, chip uses hash lookup method to get index, which will inevitably lead to hash conflicts.
  FTM supports the replacement of hash polynomials in different rams, which can reduce the probability of hash conflict in different scenarios
  and maximize resource utilization as much as possible.
  Relevant API references: ctcs_ftm_set_hash_poly/ctcs_ftm_get_hash_poly.
\p
  Before Arctic, FTM defines an enumeration value for each hash polynomial independently. 
  However, with development of chips, enumeration numbers increase, which makes API unfriendly.
\p
  So from Arctic, enumeration values (CTC_FTM_HASH_POLY_TYPE_x) no longer represent a specific hash polynomials, which only reflects how many polynomials a ram supports.
  For specific polynomial meanings, Please refer to the SDK CLI debug show.

*/

#ifndef _CTC_USW_FTM_H
#define _CTC_USW_FTM_H
#ifdef __cplusplus
extern "C" {
#endif

/****************************************************************
*
* Defines and Macros
*
****************************************************************/

/**
 @addtogroup allocation FTM
 @{
*/

/**
 @brief Profile information

 @param[in] lchip    local chip id

 @param[in] ctc_profile_info  allocation profile information

 @remark[AT] profile_type was assgint to select the profile type, refer to ctc_ftm_profile_type_t

 @return CTC_E_XXX

*/
extern int32
ctc_at_ftm_mem_alloc(uint8 lchip, ctc_ftm_profile_info_t* ctc_profile_info);

/**
 @brief Get hash polynomial

 @param[in] lchip    local chip id

 @param[in] hash_poly  hash polynomial info

 @remark[AT] Get the hash polynomial capability of the specific memory id

 @return CTC_E_XXX

*/

extern int32
ctc_at_ftm_get_hash_poly(uint8 lchip, ctc_ftm_hash_poly_t* hash_poly);

/**
 @brief Set hash polynomial

 @param[in] lchip    local chip id

 @param[in] hash_poly  hash polynomial info

 @remark[AT] Set a new hash polynomial to the specific memory id

 @return CTC_E_XXX

*/
extern int32
ctc_at_ftm_set_hash_poly(uint8 lchip, ctc_ftm_hash_poly_t* hash_poly);

/**
 @brief set spec Profile

 @param[in] lchip    local chip id

 @param[in] spec_type   spec type

 @param[in] value   profile value\

 @remark[AT] Set chip capability with spec_type and value

 @return CTC_E_XXX

*/
extern int32
ctc_at_ftm_set_profile_specs(uint8 lchip, uint32 spec_type, uint32 value);

/**
 @brief get spec Profile

 @param[in] lchip    local chip id

 @param[in] spec_type   spec type

 @param[out] value   got the profile value

 @remark[AT] Get capability with spec_type

 @return CTC_E_XXX

*/
extern int32
ctc_at_ftm_get_profile_specs(uint8 lchip, uint32 spec_type, uint32* value);

/**
 @brief Free Ftm Memory

 @param[in] lchip    local chip id

 @remark[AT] deinit the ftm resource

 @return CTC_E_XXX

*/
extern int32
ctc_at_ftm_mem_free(uint8 lchip);
/**@} end of @addtogroup allocation FTM  */

#ifdef __cplusplus
}
#endif

#endif

